from django.db import models


# Create your models here.
class employee(models.Model):
    GENDER_CHOICE = [('F', '女'), ('M', '男')]
    name = models.CharField(max_length=50, unique=True)
    password = models.CharField(max_length=20)
    gender = models.CharField(max_length=1, choices=GENDER_CHOICE)
    age = models.IntegerField()
    department = models.CharField(max_length=10)
    kpi = models.DecimalField(max_digits=5, decimal_places=2)
    address = models.CharField(max_length=50, default='北京')
    updatetime = models.DateTimeField(auto_now=True)
    createtime = models.DateTimeField(auto_now_add=True)

# 用例表
class casedata(models.Model):
    casename=models.CharField(max_length=50,unique=True)
    status=models.CharField(max_length=50)
    step=models.TextField()
    expect=models.CharField(max_length=100)
    employee=models.ForeignKey(employee,on_delete=models.CASCADE,related_name='casedata',default=21)

# bug表
class bugdata(models.Model):
    title=models.CharField(max_length=100,unique=True)
    step = models.TextField()
    expected=models.CharField(max_length=100)
    actual=models.CharField(max_length=100)
    status=models.CharField(max_length=50)
    assigned=models.CharField(max_length=50,null=False)
    case=models.ForeignKey(casedata,on_delete=models.CASCADE,related_name='bugdata')
    employee = models.ForeignKey(employee, on_delete=models.CASCADE, related_name='bugdata',default=21)
